import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
let Home = () => import("../views/Home.vue");
let Account = () => import("../views/Account.vue");
let Call = () => import("../views/Call.vue");
let Cart = () => import("../views/Cart.vue");
let Classify = () => import("../views/Classify.vue");
let Goodsdetails = () => import("../views/Goodsdetails.vue");
let Goodslist = () => import("../views/Goodslist.vue");
let Login = () => import("../views/Login.vue");
let Register = () => import("../views/Register.vue");
let Shop = () => import("../views/Shop.vue");

const routes = [
  {
    path: "/home",
    component: Home,
    name: "home"
  },
  {
    path: "/",
    redirect: "/home/:id" //重定向
  },
  {
    path: "/account",
    component: Account,
    name: "account"
  },
  {
    path: "/call",
    component: Call,
    name: "call"
  },
  {
    path: "/cart",
    component: Cart,
    name: "cart"
  },
  {
    path: "/classify",
    component: Classify,
    name: "classify"
  },
  {
    path: "/goodsdetails",
    component: Goodsdetails,
    name: "goodsdetails"
  },
  {
    path: "/goodslist",
    component: Goodslist,
    name: "goodslist"
  },
  {
    path: "/login",
    component: Login,
    name: "login"
  },
  {
    path: "/register",
    component: Register,
    name: "register"
  },
  {
    path: "/shop",
    component: Shop,
    name: "shop"
  }
];

const router = new VueRouter({
  routes
});

export default router;
